<template>
	<view class="container">
		<view class="yy-doc-con">
			<view class="yy-doc-con-img">
				<view class="yy-doc-con-imgsub">
					<image :src="doc.avatar" mode="widthFix"></image>
				</view>
			</view>
			<view class="yy-doc-con-t">
				<view class="yy-doc-con-t-part">
					<view class="yy-doc-con-t-part-t">
						<text>{{doc.nickname}}</text>
						<text>{{doc.title}}</text>
					</view>
					<view class="yy-doc-con-t-part-b">
						<text>{{doc.hospital_name}}</text>
						<text>{{doc.department_name}}</text>
					</view>
				</view>
				<view class="yy-doc-con-t-des">
					{{doc.bio}}
					<view class="yy-doc-con-t-desshadow"></view>
				</view>
				<!-- <view class="yy-doc-con-t-des-btn">
					<text>展开</text>
					<view class="yy-doc-con-t-des-btnImg">
						<image :src="['../../static/ic_down.png':'../../static/ic_up.png']" mode="widthFix"></image>
					</view>
				</view> -->
			</view>
			<!-- <view class="line"></view> -->
			<!-- <view class="yy-doc-con-des">
				<text>擅长领域</text>
				<text>牙体牙髓病是指发生在牙齿本身的疾病，以及由此引起的根尖周组织相关疾病。常见的牙体牙髓疾病包括龋病、非龋性牙体组织缺损（如外伤、楔状缺损、四环素牙、氟牙症等）、牙髓炎和根尖周炎等。</text>
			</view> -->
		</view>
		<view class="yy-doc-footer">
			<view class="yy-doc-footer-btn" @click="ghpages(doc.id)" v-if="status == 0">预约挂号</view>
			<view class="yy-doc-footer-btn" v-else>已约满</view>
		</view>
		<view class="pagedes" v-show="officedes == 1">
			<view class="pagedesnav">
				<view class="pagedesSub">
					<view class="pagedesSub-top">
						<text v-html="text"></text>
					</view>
					<view class="pagedesSub-bottom" @click="hidoffice">知道了</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import app from '../../App.vue'
	export default{
		data(){
			return{
				officedes:1,  //科室介绍
				docId:'',		//医生id
				ksId:'',		//科室id
				text:'',		//科室详情
				doc:'',			//医生简介
				status:'',		//挂号视频
			}
		},
		onLoad(options) {
			console.log(options)
			this.docId = options.id
			this.ksId = options.mzId
			this.status = options.status
		},
		onShow() {
			this.getksdetail()
			this.getdocdetail()
		},
		methods:{
			hidoffice(){
				this.officedes = 0
			},
			getksdetail(){			//科室详情
				let that = this,
				data = {
					department_id:that.ksId
				}
				app.post('api/department/getDepartmentInfo',data).then(res=>{
					if(res.code == 1){
						that.text = res.data.description
					}
				})
			},
			getdocdetail(){				//医生详情
				let that = this,
				data = {
					user_id:that.docId
				}
				app.post('api/user/info',data).then(res=>{
					if(res.code == 1){
						that.doc = res.data
					}
				})
			},
			ghpages(id){
				let that = this
				// console.log(that.ksId)
				uni.showLoading({
					title:'加载中',
					success() {
						setTimeout(function(){
							uni.hideLoading()
							uni.navigateTo({
								url:'/pages/yuyue/choosedate?id='+id+'&status='+that.status+'&mzId='+that.ksId
							})
						},1300)
					}
				})
			}
		}
	}
</script>

<style>
	@import url("../../common/yuyuedoc.css");
</style>
